<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>MeteoCal - Registration</title>
    </h:head>
    <h:body>
        <h:form id="registrationform">
            <p:panel header="MeteoCal - Registration">
                <h:panelGrid columns="3" id="regGrid">
                    <p:outputLabel for="name">Username:</p:outputLabel>
                    <p:inputText id="username" value="#{registrationView.user.username}">
                        <p:ajax update="usernamemsg"/>
                    </p:inputText>
                    <p:message id="usernamemsg" for="username" />
                    <p:outputLabel for="name">Name:</p:outputLabel>
                    <p:inputText id="name" value="#{registrationView.user.name}">
                        <p:ajax update="namemsg"/>
                    </p:inputText>
                    <p:message id="namemsg" for="name" />
                    <p:outputLabel for="surname">Surname:</p:outputLabel>
                    <p:inputText id="surname" value="#{registrationView.user.surname}">
                        <p:ajax update="surnamemsg"/>
                    </p:inputText>
                    <p:message id="surnamemsg" for="surname" />

                    <p:outputLabel for="birthdate">Date of birth:</p:outputLabel>
                    <p:calendar id="birthdate" value="#{registrationView.user.dateOfBirth}" pattern="dd-MM-yyyy" mask="true">
                        <p:ajax update="birthmsg"/>
                    </p:calendar>
                    <p:message id="birthmsg" for="birthdate" />

                    <p:outputLabel for="email">Email:</p:outputLabel>
                    <p:inputText id="email" value="#{registrationView.user.email}">
                        <p:ajax update="emailmsg"/>
                    </p:inputText>
                    <p:message id="emailmsg" for="email" />

                    <p:outputLabel for="password">Password:</p:outputLabel>
                    <p:password id="password" value="#{registrationView.user.password}"
                                label="Password"   feedback="true" match="pwd2">
                    </p:password>
                    <p:message id="passwordmsg" for="password" />

                    <p:outputLabel for="pwd2">Confirm Password:</p:outputLabel>
                    <p:password id="pwd2" label="Confirm Password" >
                        <p:ajax update="pwd2msg"/>
                    </p:password>
                    <p:message id="pwd2msg" for="pwd2" />

                    <p:outputLabel for="description">Personal description:</p:outputLabel>
                    <p:inputTextarea id="description" rows="6" cols="33"  value="#{registrationView.user.description}"/>
                </h:panelGrid>
                <p:commandButton id="submit" value="Register" update="regGrid"
                                 action="#{registrationView.register()}" />
                <p:button href="/index.xhtml" value="Cancel"/>
            </p:panel>
        </h:form>
        <div style="position: relative; text-align: center">
            <p style="position: fixed; bottom: 0; width:100%;"> Powered by Andrea Sorbelli and Michele Zanella</p>
        </div>
    </h:body>
</html>

